GODRIVER-3892 Move count to the mongo package.#2483
Conversation
API Change Report./v2/x/mongo/driver/operationincompatible changesCount: removed |
🧪 Performance ResultsCommit SHA: 554f9c4The following benchmark tests for version 6a59dbf8a8cda90007976081 had statistically significant changes (i.e., |z-score| > 1.96):
For a comprehensive view of all microbenchmark results for this PR's commit, please check out the Evergreen perf task for this patch. |
6e1c991 to
969385a
Compare
There was a problem hiding this comment.
Pull request overview
This PR moves the internal “count” operation implementation out of x/mongo/driver/operation and into the mongo package, simplifying EstimatedDocumentCount by removing the chainable setter style and keeping the moved types unexported.
Changes:
- Removed the legacy
Countoperation implementation fromx/mongo/driver/operation. - Added an unexported
countOpimplementation inmongo/to execute the count command and parse results. - Updated
Collection.EstimatedDocumentCountto construct and runcountOpdirectly, settingcomment/rawDatafields without setters.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| x/mongo/driver/operation/count.go | Removes the previous Count operation implementation from the x/ operations layer. |
| mongo/op_count.go | Adds the new unexported countOp + result parsing logic in the mongo package. |
| mongo/collection.go | Switches EstimatedDocumentCount from operation.NewCount() to the new countOp struct literal wiring. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
GODRIVER-3892
Summary
Move the count operation logic from the
x/mongo/driver/operationpackage to themongopackage, removing the unnecessary chainable setters. Don't export the moved types.Background & Motivation
Part of a larger effort to reduce unnecessary code by removing the
x/mongo/driver/operationpackage.